﻿<Window x:Class="DemoApplication.Demos.Task.TaskDialogCreator"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:bh="http://www.brokenhouse.co.uk/wpf"
        xmlns:local="clr-namespace:DemoApplication.Demos"
        Title="Task Dialog" Height="539" Width="735">

    <Window.Resources>

        <DataTemplate x:Key="IconTemplate">
            <StackPanel Orientation="Horizontal" Margin="1">
                <bh:Icon Width="16" Height="16"   Source="{Binding BitmapSource}" VerticalAlignment="Center"/>
                <TextBlock Margin="3,0,0,0" Text="{Binding Label}" VerticalAlignment="Center"/>
            </StackPanel>
        </DataTemplate>

        <DataTemplate x:Key="ButtonSetTemplate">
            <StackPanel Orientation="Horizontal" Margin="1">
                <TextBlock Margin="3,0,0,0" Text="{Binding Label}" VerticalAlignment="Center"/>
            </StackPanel>
        </DataTemplate>

        <DataTemplate x:Key="CommandLinkTemplate">
            <Border Margin="2"
                    BorderBrush="{DynamicResource {x:Static SystemColors.ControlDarkBrushKey}}" 
                    BorderThickness="1" CornerRadius="2" SnapsToDevicePixels="True">
                <Grid Margin="2" >
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto"/>
                        <ColumnDefinition Width="*"/>
                    </Grid.ColumnDefinitions>
                    <Grid.RowDefinitions>
                        <RowDefinition/>
                        <RowDefinition/>
                        <RowDefinition/>
                    </Grid.RowDefinitions>
                    <TextBlock Text="Instruction" Margin="6" VerticalAlignment="Center" HorizontalAlignment="Right"/>
                    <TextBlock Grid.Row="1" Text="Content" Margin="6" VerticalAlignment="Center" HorizontalAlignment="Right"/>
                    <TextBlock Grid.Row="2" Text="Icon" Margin="6" VerticalAlignment="Center" HorizontalAlignment="Right"/>
                    <TextBox x:Name="InstructionText" Grid.Column="1" VerticalAlignment="Center" Text="{Binding Instruction}" Margin="3"/>
                    <TextBox x:Name="ContentText" Grid.Row="1" Grid.Column="1" VerticalAlignment="Center" MinLines="3" Margin="3"
                             Text="{Binding Content}"/>
                    <ComboBox Grid.Row="3" Grid.Column="1" Width="150" HorizontalAlignment="Left"
                                      ItemsSource="{x:Static local:DataProvider.StockIconInfos}" SelectedItem="{Binding IconInfo}" 
                                      Margin="3"
                                      ItemTemplate="{StaticResource IconTemplate}"/>
                </Grid>
            </Border>

        </DataTemplate>

    </Window.Resources>

    <DockPanel>

        <StackPanel DockPanel.Dock="Bottom" Orientation="Horizontal" HorizontalAlignment="Center">
            <Button Width="100" Margin="5" Content="Show Dialog" Click="OnShowDialogClicked"/>
            <Button Width="100" Margin="5" Content="Copy Code" Click="OnGenerateCode"/>
        </StackPanel>
        
        <Border Margin="2,0,0,2"
                BorderBrush="{DynamicResource {x:Static SystemColors.ControlDarkBrushKey}}" 
                BorderThickness="1" CornerRadius="2" SnapsToDevicePixels="True"
                Background="{DynamicResource {x:Static SystemColors.ControlBrushKey}}">
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="*" MinWidth="280"/>
                    <ColumnDefinition Width="*" MinWidth="280"/>
                </Grid.ColumnDefinitions>
                <Grid.RowDefinitions>
                    <RowDefinition/>
                </Grid.RowDefinitions>

                <Grid Margin="2" >
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto"/>
                        <ColumnDefinition Width="*"/>
                    </Grid.ColumnDefinitions>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="*"/>
                    </Grid.RowDefinitions>
                    <TextBlock Text="Title" Margin="6" VerticalAlignment="Center" HorizontalAlignment="Right"/>
                    <TextBlock Grid.Row="1" Text="Instruction" Margin="6" VerticalAlignment="Center" HorizontalAlignment="Right"/>
                    <Line Grid.Row="1" X1="0" X2="1" Y1="0" Y2="0" Stroke="{DynamicResource {x:Static SystemColors.ControlDarkBrushKey}}"  StrokeThickness="1" Grid.ColumnSpan="2" Stretch="UniformToFill" VerticalAlignment="Top"/>
                    <TextBlock Grid.Row="2" Text="Message" Margin="6" VerticalAlignment="Center" HorizontalAlignment="Right"/>
                    <Line Grid.Row="2" X1="0" X2="1" Y1="0" Y2="0" Stroke="{DynamicResource {x:Static SystemColors.ControlDarkBrushKey}}"  StrokeThickness="1" Grid.ColumnSpan="2" Stretch="UniformToFill" VerticalAlignment="Top"/>
                    <TextBlock Grid.Row="3" Text="Footer" Margin="6" VerticalAlignment="Center" HorizontalAlignment="Right"/>
                    <Line Grid.Row="3" X1="0" X2="1" Y1="0" Y2="0" Stroke="{DynamicResource {x:Static SystemColors.ControlDarkBrushKey}}"  StrokeThickness="1" Grid.ColumnSpan="2" Stretch="UniformToFill" VerticalAlignment="Top"/>
                    <TextBlock Grid.Row="4" Text="Check Box" Margin="6" VerticalAlignment="Center" HorizontalAlignment="Right"/>
                    <Line Grid.Row="4" X1="0" X2="1" Y1="0" Y2="0" Stroke="{DynamicResource {x:Static SystemColors.ControlDarkBrushKey}}"  StrokeThickness="1" Grid.ColumnSpan="2" Stretch="UniformToFill" VerticalAlignment="Top"/>
                    <TextBlock Grid.Row="5" Text="Expander" Margin="6" VerticalAlignment="Center" HorizontalAlignment="Right"/>
                    <Line Grid.Row="5" X1="0" X2="1" Y1="0" Y2="0" Stroke="{DynamicResource {x:Static SystemColors.ControlDarkBrushKey}}"  StrokeThickness="1" Grid.ColumnSpan="2" Stretch="UniformToFill" VerticalAlignment="Top"/>
                    <TextBlock Grid.Row="6" Text="Buttons" Margin="6" VerticalAlignment="Center" HorizontalAlignment="Right"/>
                    <Line Grid.Row="6" X1="0" X2="1" Y1="0" Y2="0" Stroke="{DynamicResource {x:Static SystemColors.ControlDarkBrushKey}}"  StrokeThickness="1" Grid.ColumnSpan="2" Stretch="UniformToFill" VerticalAlignment="Top"/>
                    <TextBox Grid.Column="1" VerticalAlignment="Center" Text="{Binding DialogTitle}" Margin="3"/>
                    <StackPanel Grid.Row="1" Grid.Column="1">
                        <TextBox VerticalAlignment="Center" Text="{Binding Instruction}" Margin="3"/>
                        <ComboBox Grid.Row="2" Grid.Column="1" Width="150" HorizontalAlignment="Left"
                                  ItemsSource="{x:Static local:DataProvider.StockIconInfos}" SelectedItem="{Binding MainIconInfo}" 
                                  Margin="3"
                                  ItemTemplate="{StaticResource IconTemplate}"/>
                    </StackPanel>
                    <StackPanel Grid.Row="2" Grid.Column="1">
                        <TextBox MinLines="3" Margin="3" Text="{Binding MessageText}"/>
                        <CheckBox IsChecked="{Binding ShowMessageInFooter}" Content="Show in footer" Margin="3" VerticalAlignment="Center"/>
                        <CheckBox IsChecked="{Binding AutoExpandMessage}" Content="Auto expand" Margin="3" VerticalAlignment="Center"/>
                    </StackPanel>
                    <StackPanel Grid.Row="3" Grid.Column="1">
                        <TextBox VerticalAlignment="Center" Margin="3" Text="{Binding FooterText}"/>
                        <ComboBox Width="150" HorizontalAlignment="Left"
                                  ItemsSource="{x:Static local:DataProvider.StockIconInfos}" SelectedItem="{Binding FooterIconInfo}" 
                                  Margin="3"
                                  ItemTemplate="{StaticResource IconTemplate}"/>
                    </StackPanel>
                    <StackPanel Grid.Row="4" Grid.Column="1">
                        <TextBox Margin="3" Text="{Binding CheckBoxText}"/>
                        <CheckBox Margin="3" Content="State" IsChecked="{Binding CheckBoxState}" VerticalAlignment="Center"/>
                    </StackPanel>
                    <StackPanel Grid.Row="5" Grid.Column="1">
                        <TextBox VerticalAlignment="Center" Margin="3" Text="{Binding CollapsedText}"/>
                        <TextBox VerticalAlignment="Center" Margin="3" Text="{Binding ExpandedText}"/>
                        <CheckBox Margin="3" IsChecked="{Binding IsExpanded}" VerticalAlignment="Center" Content="Is Expanded" />
                    </StackPanel>
                    <ComboBox Grid.Row="6" Grid.Column="1" Width="150" HorizontalAlignment="Left"
                              ItemsSource="{x:Static local:DataProvider.ButtonSetInfos}" SelectedValue="{Binding ButtonSet}"  
                              SelectedValuePath="ButtonSet" Margin="3"
                              ItemTemplate="{StaticResource ButtonSetTemplate}"/>
                </Grid>
                <Line Grid.Column="1" X1="0" X2="0" Y1="0" Y2="1" Stroke="{DynamicResource {x:Static SystemColors.ControlDarkBrushKey}}" 
                      StrokeThickness="1" Grid.ColumnSpan="2" Stretch="UniformToFill" HorizontalAlignment="Left"/>
                <DockPanel Grid.Column="1">
                    <Grid DockPanel.Dock="Top" >
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto"/>
                            <ColumnDefinition Width="*"/>
                        </Grid.ColumnDefinitions>
                        <Grid.RowDefinitions>
                            <RowDefinition/>
                            <RowDefinition/>
                        </Grid.RowDefinitions>
                        <TextBlock Text="Content" Margin="6" VerticalAlignment="Center" HorizontalAlignment="Right"/>
                        <StackPanel Grid.Row="0" Grid.Column="1">
                            <TextBox MinLines="3" Margin="3" Text="{Binding ContentText}"/>
                            <CheckBox IsChecked="{Binding AutoExpandContent}" Content="Auto Expand" Margin="3" VerticalAlignment="Center"/>
                        </StackPanel>
                    </Grid>
                    <Line DockPanel.Dock="Top" X1="0" X2="1" Y1="0" Y2="0" Stroke="{DynamicResource {x:Static SystemColors.ControlDarkBrushKey}}"  StrokeThickness="1" Grid.ColumnSpan="2" Stretch="UniformToFill" VerticalAlignment="Top"/>
                    <DockPanel DockPanel.Dock="Top">
                        <StackPanel Orientation="Horizontal" DockPanel.Dock="Right" FocusManager.IsFocusScope="True">
                            <Button Content="Add" Margin="2" Click="OnAddClicked" IsEnabled="{Binding CanAddLink}"/>
                            <Button Content="Remove" Margin="2" Click="OnRemoveClicked" IsEnabled="{Binding CanRemoveLink}"/>
                        </StackPanel>
                        <TextBlock Text="CommandLinks" Padding="6"/>
                    </DockPanel>

                    <ListBox Margin="4,2,2,2" ItemsSource="{Binding CommandLinks}" SelectedItem="{Binding SelectedCommandLink}"
                             ItemTemplate="{StaticResource CommandLinkTemplate}" MaxHeight="350" Height="350"
                             HorizontalContentAlignment="Stretch">

                    </ListBox>
                </DockPanel>
            </Grid>
        </Border>


    </DockPanel>
</Window>
